/**
 *
 */
package com.angel.architecture.interceptors;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.angel.architecture.BaseArchitectureTestCase;
import com.angel.dao.generic.exceptions.OnPersitHibernateException;
import com.angel.mocks.architecture.services.AddressService;
import com.angel.mocks.factories.AddressFactory;
import com.angel.mocks.providers.Address;

/**
 * @author William
 *
 */
public class ServiceInterceptorTestCase extends BaseArchitectureTestCase{

	@Autowired
	private AddressService addressService;

	@Test
	public void testValidCreateAddressWithServiceNotMapped(){
		Address address = AddressFactory.createAddress();
		addressService.create(address);
	}

	@Test
	public void testInvalidCreateAddressWithServiceNotMapped(){
		Address address = AddressFactory.createEmptyAddress();
		try {
			addressService.create(address);
			fail("It must throw a NonBusinessException because it creates an empty address.");
		} catch (OnPersitHibernateException e) {

		}
	}
}
